package com.wigem.fa.controller;

import com.wigem.framework.common.pojo.PageResult;
import com.wigem.framework.common.util.web.response.Result;
import com.wigem.framework.common.util.web.response.ResultController;
import java.util.List;
import com.wigem.fa.entity.FaApplyFileEntity;
import com.wigem.fa.service.FaApplyFileService;
import com.wigem.fa.vo.FaApplyFileVo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.swing.text.html.parser.Entity;

/**
 * 申请附件Controller
 *
 * @author ls
 * @date 2024-11-01
 */
@RestController
@RequestMapping("/fa/applyFile")
public class FaApplyFileController extends ResultController {


    @Resource
    private FaApplyFileService faApplyFileService;

    /**
     * 查询申请附件列表
     */
    @ResponseBody
    @GetMapping("/query")
    public Result getList(FaApplyFileVo faApplyFileVo) {
        return success(faApplyFileService.getList(faApplyFileVo));
    }

    /**
     * 查询申请附件列表
     */
    @ResponseBody
    @GetMapping("/query/page")
    public Result getPageList(FaApplyFileVo faApplyFileVo) {
        PageResult<FaApplyFileEntity> pageInfo = faApplyFileService.getPageList(faApplyFileVo);
        return success(pageInfo);
    }

    /**
     * 查询申请附件实体
     */
    @ResponseBody
    @GetMapping("/query/{id}")
    public Result getEntity(@PathVariable("id") String id) {
        return success(faApplyFileService.getEntity(id));
    }

    /**
     * 查询申请附件实体
     */
    @ResponseBody
    @GetMapping("/getListByApplyId/{applyId}")
    public Result getListByApplyId(@PathVariable("applyId") String id) {
        return success(faApplyFileService.getListByApplyId(id));
    }

    /**
     * 申请附件新增
     */
    @ResponseBody
    @PostMapping
    public Result add(@RequestBody FaApplyFileVo faApplyFileVo) {
            faApplyFileService.add(faApplyFileVo);
        return success("保存成功");
    }

    /**
     * 申请附件修改
     */
    @ResponseBody
    @PutMapping
    public Result update(@RequestBody FaApplyFileVo faApplyFileVo) {
            faApplyFileService.update(faApplyFileVo);
        return success("修改成功");
    }


    /**
     * 新增保存
     */
    @ResponseBody
    @PostMapping("/save")
    public Result save(@RequestBody FaApplyFileVo faApplyFileVo) {
            faApplyFileService.save(faApplyFileVo);
        return success("保存成功！");
    }


    /**
    * 删除
    */
    @ResponseBody
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") String id) {
            faApplyFileService.delete(id);
        return success("删除成功！");
    }

    /**
     * 移除/逻辑删除
     */
    @ResponseBody
    @DeleteMapping("/remove/{id}")
    public Result remove(@PathVariable("id") String id) {
            faApplyFileService.remove(id);
        return success("删除成功！");
    }
}
